import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '#/layouts';
import { $t } from '#/locales';
import {
  DoorClosed,
  LogIn,
  Truck,
  Users,
  ShieldAlert,
  Warehouse,
  MapPin,
  BarChart3,
  Beaker,
  Bell,
  FileText,
  Briefcase,
  UserCheck,
  Car,
  ClipboardCheck,
  ZoomIn,
  AlertTriangle,
  Cog,
  ParkingCircle,
  CalendarCheck,
  ClipboardList,
  Map,
  AlertOctagon,
  LineChart,
  Route,
  AlertCircle,
  UserX,
  Crosshair,
  Eye,
  Home, // 添加 Home 图标
} from 'lucide-vue-next';

const routes: RouteRecordRaw[] = [
  {
    component: BasicLayout,
    meta: {
      icon: DoorClosed,
      order: 4000,
      title: $t('page.systemManagement.title'),
      authority: ['AC100000'],
    },
    name: 'SystemManagement',
    path: '/system-management',
    children: [
      // {
      //   name: 'DepartmentManagement',
      //   path: 'department-management',
      //   component: () =>
      //     import('#/views/system-management/DepartmentManagement.vue'),
      //   meta: {
      //     // icon: ShieldAlert,
      //     title: $t('page.systemManagement.departmentManagement'),
      //   },
      // },
      // {
      //   name: 'RightsManagement',
      //   path: 'rights-management',
      //   component: () =>
      //     import('#/views/system-management/RightsManagement.vue'),
      //   meta: {
      //     // icon: ShieldAlert,
      //     title: $t('page.systemManagement.rightsManagement'),
      //   },
      // },
      {
        name: 'StaffManagement',
        path: 'staff-management',
        component: () =>
          import('#/views/system-management/StaffManagement.vue'),
        meta: {
          // icon: ShieldAlert,
          title: $t('page.systemManagement.staffManagement'),
        },
      },
    ].filter((route) => {
      if (!route.name) {
        console.error('Route missing name:', route);
        return false;
      }
      return true;
    }),
  },
];

// 添加一个检查函数
function checkRoutes(routes: RouteRecordRaw[]) {
  routes.forEach((route) => {
    if (!route.name) {
      console.error('Route missing name:', route);
    }
    if (route.children) {
      checkRoutes(route.children);
    }
  });
}

checkRoutes(routes);

export default routes;
